package com.helloworld.fiberflax.weapon;

import com.helloworld.fiberflax.Fiberflax;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

import static com.helloworld.fiberflax.Fiberflax.FIBERFLAX_CREATIVE_TAB;
import static com.helloworld.fiberflax.Fiberflax.Yamato;

public class FiberflaxSword extends ItemSword {
    public FiberflaxSword(ToolMaterial material) {
        super(material);
        setCreativeTab(FIBERFLAX_CREATIVE_TAB);
        setRegistryName(new ResourceLocation(Fiberflax.MODID,"item_fiberflax_sword"));
    }

    @Override
    public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
        playerIn.addPotionEffect(new PotionEffect(MobEffects.INSTANT_HEALTH,20,0));
        playerIn.getHeldItem(handIn).damageItem(25,playerIn);
        return super.onItemRightClick(worldIn, playerIn, handIn);
    }
}
